package mobi.greenplate.theweb.converter;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import mobi.greenplate.theweb.domain.UserDetail;
//for : enum types (and many-to-one)

import mobi.greenplate.theweb.domain.UserType;

@XmlRootElement(name = "userDetail")
public class UserDetailConverter {

    private final UserDetail entity;

    public UserDetailConverter() {
        this.entity = new UserDetail();
    }

    public UserDetailConverter(UserDetail entity) {
        this.entity = entity;
    }

    @XmlTransient
    public UserDetail getEntity() {
        return entity;
    }

    @XmlElement
    public Long getId() {
        return entity.getId();
    }

    public void setId(Long id) {
        entity.setId(id);
    }

    @XmlElement
    public String getFirstName() {
        return entity.getFirstName();
    }

    public void setFirstName(String firstName) {
        entity.setFirstName(firstName);
    }

    @XmlElement
    public String getLastName() {
        return entity.getLastName();
    }

    public void setLastName(String lastName) {
        entity.setLastName(lastName);
    }

    @XmlElement
    public String getPhone() {
        return entity.getPhone();
    }

    public void setPhone(String phone) {
        entity.setPhone(phone);
    }

    @XmlElement
    public String getEmail() {
        return entity.getEmail();
    }

    public void setEmail(String email) {
        entity.setEmail(email);
    }

    @XmlElement
    public UserType getType() {
        return entity.getType();
    }

    public void setType(UserType type) {
        entity.setType(type);
    }

    @XmlElement
    public UserConverter getOwner() {
        return new UserConverter(entity.getOwner());
    }

    public void setOwner(UserConverter userConverter) {
        entity.setOwner(userConverter.getEntity());
    }
}
